#ifndef VECTORCHROMOSOME_H_
#define VECTORCHROMOSOME_H_

#include <QList>

#include "Chromosome.h"


/**
  * @author Łukasz Szybka
  */
template<class T>
class VectorChromosome : public Chromosome
{
public:
    VectorChromosome();
    VectorChromosome(int size);
    /**
      * Constructor
      * @param size Lenght of chromosome
      */
    VectorChromosome(int size, T min, T max);
    VectorChromosome(T min, T max);
    /**
      * Copy constructor
      * @param other VectorChromosome to copy
      */
    VectorChromosome(const VectorChromosome &other);
    /**
      * Destructor
      */
    virtual ~VectorChromosome();

    VectorChromosome<T>& operator=(const VectorChromosome<T>& other);

    virtual void setRandom();
    virtual void crossOver(const Chromosome& partner);
    virtual void mutate(int index);

    virtual bool operator==(const Chromosome& other) const;

    virtual QVariant at(int index) const;
    virtual QVariant data() const;
    virtual int size() const;

protected:
    virtual T getRandomValue() const = 0;

    QList<T> geneArray;
    T minValue;
    T maxValue;
private:

};

#include "VectorChromosome.cpp" //needed to link template in gcc which doesn't support export

#endif /*VECTORCHROMOSOME_H_*/
